package com.lwm.string;

import org.junit.Test;

/**
 * @author liweimin
 * @date 2020/9/25 16:35
 * @description
 */
public class StringTest {
    @Test
    public void test1() {
        //字面量---->字符串常量池中
        String a = "a";
        String b = "a";
        System.out.println(a == b);
        a = "hello";
        System.out.println(a);
        System.out.println(b);
        String replace = a.replace("a", "aa");
    }

    @Test
    public void test2() {
        String str = "hello";
        String string = new String("hello");
        String str1 = new String();
        String str2 = new String(str);

    }

    @Test
    public void test3() {
        String xxz = "ewqewqeq";
        String[] split = xxz.split("\\|");
        boolean matches = xxz.matches(".*\\|.*");
        System.out.println(matches);
        for (String s : split) {
            System.out.println(s);
        }
    }

    @Test
    public void test04() {
        //本质 this.value = new char[0];
        String s = new String();
    }
}
